using System;
using System.Collections.Generic;

namespace UwinEducation.Shared.Exceptions
{
    /// <summary>
    /// 业务异常类
    /// </summary>
    public class BusinessException : ArgumentException
    {
        /// <summary>
        /// 错误码
        /// </summary>
        public string Code { get; }

        /// <summary>
        /// 错误消息列表
        /// </summary>
        public List<string> Messages { get; }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="messages">错误消息列表</param>
        /// <param name="code">错误码</param>
        public BusinessException(List<string> messages, string paramName)
            : base(string.Join("; ", messages))
        {
            Code = paramName;
            Messages = messages;
        }


    }
} 